<template>
	<view>
		<button @click="goRefresh()">刷新</button>
		<view v-for="index in count">
			<view class="" style="height: 100rpx;background-color: aquamarine; margin: 5rpx;">
				测试数据{{index}}
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				count: 11,
			}
		},
		onPullDownRefresh() {
			// 他会一直刷新，不会自己停
			console.log("onPullDownRefresh 开始刷新");
			// 网络请求
			setTimeout(() => {
				uni.stopPullDownRefresh()
				console.log("stopPullDownRefresh 数据刷新完了");
			}, 2000)
		},
		onReachBottom() {
			// 数据再次加载
			console.log("onReachBottom");
			if (this.count < 200)
				this.count = this.count + 30
		},
		methods: {
			goRefresh() {
				uni.startPullDownRefresh({
					success() {
						console.log("startPullDownRefresh  success");
					},
					fail() {
						console.log("startPullDownRefresh  fail");
					},
					complete() {
						console.log("startPullDownRefresh  complete");
					}
				})
			}
		}
	}
</script>

<style>

</style>